package com.igirl.web.controller;

import com.igirl.web.service.AdService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import java.io.IOException;
import java.net.URISyntaxException;

/**
 * @Author: jiaheng
 * @Description:
 * @Date: Created in 23:27 2017/12/26
 * @Modified:
 */
@Controller
public class IndexController {

    @Autowired
    private AdService adService;
    @RequestMapping(value = "index", method = RequestMethod.GET)
    public ModelAndView index() {
        ModelAndView mv = new ModelAndView("index");
        try {
            String bigAd = this.adService.queryBigAd();
            String leftUp = this.adService.queryleftUpAd();
            mv.addObject("bigAd", bigAd);
            mv.addObject("leftUp", leftUp);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return mv;
    }
}
